/**
 * 
 */
package com.magnusart.scrumppm.learning;

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.List;

/**
 * @author magnus
 *
 */
public class LearningSWTBasics extends ApplicationWindow
{
	
	public LearningSWTBasics( ) {
		super( null );
	}

	public static void main(String[] args) {
	    LearningSWTBasics app = new LearningSWTBasics();
	    app.setBlockOnOpen(true);
	    app.open();
	    Display.getCurrent().dispose();
	}
	
	
	
	@Override
	protected Control createContents( Composite parent ) {
		new TestContent( parent );
		return parent;
	}

	private static class TestContent extends Composite {
		TestContent( Composite parent ) {
			super( parent, SWT.None );
			Group grp = new Group( this, SWT.SHADOW_ETCHED_IN );
			
			RowLayout layout = new RowLayout(SWT.VERTICAL);
			layout.wrap = true;
			layout.fill = false;
			layout.justify = true;
			this.setLayout(layout);


			grp.setText( "Projects" );
			
			Button bt1 = new Button( grp, SWT.PUSH );
			bt1.setText( "GroupButton" );
			bt1.setLocation( 20, 20 );
			
			grp.pack();
			
			List list = new List( this, SWT.BORDER | SWT.H_SCROLL );
			
			Button next = new Button( this, SWT.PUSH );
			
			String test = String.format( "%1$-50s", "Första" );
			
			list.add( test );
			list.add( "Andra" );
			list.add(  "Tredje" );
			list.add( "Fjärde" );
			list.add( "Femte" );
			list.add( "Sjätte");
			
			next.setEnabled( true );
			next.setText( "Next" );
			next.setAlignment( SWT.RIGHT );
		
		}
	}
	
	

}
